const express = require("express");
const router = express.Router();

const expressJoi = require("@escook/express-joi");
const {
  userInfoSchema,
  updatePwdSchema,
  update_avatar_schema,
} = require("../schema/userInfo");

const {
  getUserInfo,
  updateUserInfo,
  updatePassword,
  updateAvatar,
} = require("../router_handler/userinfo");

//获取
router.get("/userinfo", getUserInfo);
//更新信息
router.post("/updateUserInfo", expressJoi(userInfoSchema), updateUserInfo);
//更新密码
router.post("/updatepwd", expressJoi(updatePwdSchema), updatePassword);
//更新头像
router.post("/update/avatar", expressJoi(update_avatar_schema), updateAvatar);

module.exports = router;
